<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
  <tr>
    
<!-- body_text //-->
    <td width="100%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0" valign=top>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0" valign=top>
          <tr>
            <td class="componentheading"><?php echo NAVBAR_TITLE_1; ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr><tr><td><table border="0" width="100%" cellspacing="1" cellpadding="2" valign=top>
          <tr>
            <td valign=top><table border="0" width="100%" cellspacing="0" cellpadding="2" valign=top>
            <tr class="sectiontableheader"><td>#</td><td><?php echo TEXT_TERMS; ?></td><td><?php echo TEXT_BILL_DATE;?></td><td><?php echo TEXT_DATE_PAYED; ?></td></tr>

<?
global $my;
$o_order_id = $_REQUEST['o_order_id'];
$orders_total = tep_count_customer_sub_payment($my->id);

if ($orders_total > 0) {

    $history_query_raw = "select sq.product_id, sq.order_id, sq.bill_date, sq.pay_date, s.price_period, s.oneday_price, s.days_as_period, s.pay_period_type  from " . TABLE_SUBSCRIPTION . " sq,". TABLE_SUBSCRIPTIONS ." s where sq.o_order_id = '$o_order_id' and  s.productid = sq.product_id order by que_id DESC";
    $history_split = new splitPageResults($history_query_raw, MAX_DISPLAY_ORDER_HISTORY);
    $history_query = tep_db_query($history_split->sql_query);
    
 $n = 1;
 $r = 0;
    while ($history = tep_db_fetch_array($history_query)) {

    $i = $n +$i;
    if ($history[price_period] > 0 || $history[oneday_price] > 0) {
  if($history[pay_period_type] == 'By Period'){
  $terms = $currencies->display_price($history[price_period], tep_get_tax_rate('0')) . TEXT_EVERY . $history[days_as_period] . TEXT_DAYS;
  } else {
  $terms = $currencies->display_price($history[price_period], tep_get_tax_rate('0')) . '  ' . $history[pay_period_type];
  }
  }else{
  $terms = 'Non Subscription';
  }
?> <tr class="sectiontableentry<?php echo $r+1;?>"><td><?
echo $i . '</td><td>' . $terms . '</td><td>' . $history[bill_date] . '</td><td>' . $history[pay_date] . '</td></tr>';
$r = 1 - $r;
}
}

?></table></td></tr><tr> <td class="main" > <table align=right><tr>
            <td class="smallText" valign="top"><?php echo $history_split->display_count(TEXT_DISPLAY_NUMBER_OF_ORDERS); ?></td>
            <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $history_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
          </tr></table></td></tr></table>
</td></tr></table></td>
<!-- body_text_eof //-->
    
  </tr>
</table>